package com.ecar.api.support.util;

import com.ecar.common.util.PropertyUtil;
import com.ecar.common.util.SpringContextUtil;
import org.springframework.stereotype.Component;

/**
 * Created by admin on 2016/11/10.
 */
@Component
public class Props {

	private static PropertyUtil propertyUtil;

	public static String getValue(String key) {
		return Props.propertyUtil.getValue(key);
	}

	public Object getBean(String beanName) {
		return SpringContextUtil.getBean(beanName);
	}

	public PropertyUtil getPropertyUtil() {
		return propertyUtil;
	}

	public void setPropertyUtil(PropertyUtil propertyUtil) {
		Props.propertyUtil = propertyUtil;
	}

	public static boolean isDebug() {
		try {
			return "true".equalsIgnoreCase(getValue("config.debug"));
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}
}
